﻿#include "unapMatrixSolver.hpp"

template <typename Cmpt>
UNAP::Solver<Cmpt>::Solver(Communicator *other_comm)
    : maxIter_(1000),
      minIter_(0),
      relTol_(1e-6),
      tolerance_(0.0),
      ifPrint_(false),
      commcator_(other_comm) {}

template <typename Cmpt>
scalar UNAP::Solver<Cmpt>::normFactor(const Vector<Cmpt> &source) const {
  return source.SumSqrt() + VSMALL;
}

template <typename Cmpt>
void UNAP::Solver<Cmpt>::SET_maxIter(int maxIter) {
  maxIter_ = maxIter;
}

template <typename Cmpt>
void UNAP::Solver<Cmpt>::SET_minIter(int minIter) {
  minIter_ = minIter;
}

template <typename Cmpt>
void UNAP::Solver<Cmpt>::SET_relTol(scalar relTol) {
  relTol_ = relTol;
}

template <typename Cmpt>
void UNAP::Solver<Cmpt>::SET_tolerance(scalar tolerance) {
  tolerance_ = tolerance;
}

template <typename Cmpt>
void UNAP::Solver<Cmpt>::SET_ifPrint(bool ifPrint) {
  ifPrint_ = ifPrint;
}

template class UNAP::Solver<scalar>;
